package com.zk5_education.service_vod.controller;


import com.zk5_education.R;
import com.zk5_education.service_vod.service.EduVideoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
/**
 * <p>
 * 课程视频 前端控制器
 * </p>
 *
 * @author testjava
 * @since 2020-08-13
 */
@RestController
@RequestMapping("/service_vod/edu_video")
@CrossOrigin
public class EduVideoController {


    @Autowired
    EduVideoService eduVideoService;

    @DeleteMapping("/deleteVideo/{videoid}")
    public R DeleteVideo(@PathVariable String videoid){
        eduVideoService.deleteVideo(videoid);

        return R.success().message("删除视频成功");
    }

    //添加视频

    @PostMapping("addVideo")
    public R addVideo(MultipartFile file){
        String addvideo = eduVideoService.addvideo(file);
        return R.success().data("Videoid",addvideo);
    }

    //批量删除视频(删除课程时使用)
    @DeleteMapping("removeBatch")
    public R removerBatch(List<String > list){
        eduVideoService.removerbatch(list);
        return R.success();
    }


}

